package Java攻略._3_流式操作._3_利用reduce方法实现归约操作;

import java.util.stream.Stream;

public class _23_利用reduce方法拼接流中的字符串 {

    public static void main(String[] args) {
        String concatStr = Stream.of("this", "is", "a", "list")
                .reduce("", String::concat);

        System.out.println(concatStr);

        concatStr = Stream.of("this", "is", "a", "list")
                .reduce("", (x, y) -> x.concat(y));
        System.out.println(concatStr);
    }
}
